<?php !defined('DYHB_PATH') && exit; /* DoYouHaoBaby Framework 模板缓存文件 生成时间：2011-05-28 11:25:35  */ ?>
<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_header.html" ,"" ,"" ,"" )  ;?>

<script type="text/javascript">
<!--
function add(){

	Dyhb.AjaxSubmit('roleAdd','<?php echo( G::U('role/insert') );?>','',complete);
}
function update(){

	Dyhb.AjaxSubmit('roleAdd','<?php echo( G::U('role/update') );?>');
}
function complete(data,status){

    if(status==1){

        $('#id').val(data.id);
    }
}

function ajaxSelect() {

   $("#ajaxSelect").css('display','block');
   var html = $.ajax({
       url: "<?php echo( G::U('role/select') );?>",
       async: false
   }).responseText;

   $("#ajaxSelect").html(html);
}

-->
</script>

   <!-- 标题  -->
   <div class="title"><?php if(empty( $nId )) :?><?php print G::L( "添加角色", null, null ) ; ?><?php else: ?><?php print G::L( "编辑角色", null, null ) ; ?><?php endif; ?> ( <a href="<?php echo( G::U('role/index') );?>"><?php print G::L( "返回角色列表", null, null ) ; ?></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<?php if(empty( $nId )) :?><?php echo( G::U('role/insert') );?><?php else: ?><?php echo( G::U('role/update') );?><?php endif; ?>" method="post" id="roleAdd" name="roleAdd">
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="role_name"><?php print G::L( "组名", null, null ) ; ?>：</label></th>
            <td><input type="text" name="role_name" id="role_name" class="field" size="40" value="<?php if(isset( $arrValue )) :?><?php echo( $arrValue['role_name'] ); ?><?php endif; ?>"/>
            <br/><div class="description"><?php print G::L( "角色的名字，比如说领导，员工", null, null ) ; ?></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_parentid"><?php print G::L( "上级组", null, null ) ; ?>：</label></th>
            <td><input type="text" name="parentRoleName" id="parentRoleName" class="field" size="40" value="<?php if(isset( $arrValue )) :?><?php echo( getRolenameByid($arrValue['role_parentid']) ); ?><?php endif; ?>"/>
            <a href="" onClick="ajaxSelect();return false;" title="<?php print G::L( "上级组", null, null ) ; ?>"><img src="__TMPLPUB__/Images/top.gif"></img></a>
            <br/><div class="description"><?php print G::L( "父级角色，采用ajax加载选择", null, null ) ; ?></div>
            </td>
          </tr>
          <tr class="none" id="ajaxSelect">
          <td><img src="__TMPLPUB__/Images/ajaxloading.gif"></img><?php print G::L( "数据加载中", null, null ) ; ?>...
		  </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_status"><?php print G::L( "组状态", null, null ) ; ?>：</label></th>
            <td><select class="field"  name="role_status">
	             <option value="1" <?php if(isset( $arrValue ) && $arrValue['role_status']==1) :?>selected<?php endif; ?>><?php print G::L( "启用", null, null ) ; ?></option>
	             <option value="0" <?php if(!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['role_status']==0 ) ) :?>selected<?php endif; ?>><?php print G::L( "禁用", null, null ) ; ?></option>
	           </select>
	           <br/><div class="description"><?php print G::L( "是否启用角色，只有启用的角色才能够使用", null, null ) ; ?></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_remark"><?php print G::L( "描述", null, null ) ; ?>：</label></th>
            <td><textarea name="role_remark" id="role_remark" class="field" cols="70" rows="5"><?php if(isset( $arrValue )) :?><?php echo( $arrValue['role_remark'] ); ?><?php endif; ?></textarea>
            <br/><div class="description"><?php print G::L( "角色相关信息描述", null, null ) ; ?></div></td>
          </tr>

          </table>
          <p class="center"><input type="hidden" name="ajax" value="1">
          <input type="hidden" name="role_parentid" id="role_parentid" value="<?php if(isset( $arrValue )) :?><?php echo( $arrValue['role_parentid'] ); ?><?php endif; ?>">
          <input type="hidden" name="id" id="id" value="<?php if(!empty( $nId )) :?><?php echo( $nId ); ?><?php endif; ?>"/>
         <input type="button" onclick="<?php if(!empty( $nId )) :?>update()<?php else: ?>add()<?php endif; ?>" class="button" value="<?php if(!empty( $nId )) :?>  <?php print G::L( "更  新", null, null ) ; ?><?php else: ?>  <?php print G::L( "发  布", null, null ) ; ?><?php endif; ?>  " />
          <input type="reset" class="button" value="  <?php print G::L( "重  置", null, null ) ; ?>  " />
        </p>
        </form>
   </div>
   <!-- end content -->

<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_footer.html" ,"" ,"" ,"" )  ;?>